Diabetes affects 8.3% of the US population, and lead to costly adverse healthcare outcomes. Unfortunately, there may be a quality gap in the care of complex diabetes patients, that is, older patients (age>65 years) and those with comorbid conditions. Current practices, relying primarily on the presence of several factors, are not effective in capturing the risk of poor prognosis, i.e., multiple hospitalization and/or emergency department visits, and death. Hence, little evidence exists so far to help prioritize care for thes patients. The diabetes guidelines recognize that tight control of glycosylated hemoglobin (A1c) may not be appropriate for complex patients, and recommend individualizations in tight A1c control. However, neither the outcomes of tight A1c control, nor the effects of the typical treatment regimens used to achieve tight A1c control can be evaluated in clinical trials, with minimal, if any, enrollment of complex diabetes patients due to either their restrictive inclusion criteria or lack of encouragement of the patient and/or clinical investigator to consider the RCT. In order to deliver more effective, efficient and accountable health cares, it is important to help clinicians to examine the relationship between patient complexity and patients' A1c control level, and to modify guideline appropriately with an evidence base. The proposed research will analyze a cohort of 8,304 Medicare beneficiaries with diabetes who were cared for by one of the country's 10 largest physician group practices, the University of Wisconsin Medical Foundation during 2003-2011 to address the following aims: (1) to conduct risk prediction incorporating longitudinal outcomes, (2) to inform guidelines for complex diabetes patients, and (3) to create a patient-centered surveillance tool for detecting short-term negative outcomes. Our analytic approach involves the use of state- of-the-art statistics and machine learning methods to take advantage of the large electronic health records data. The proposed methods and results will help clinicians to identify and quantify risks of tight A1c control in complex diabetes patients an potentially lead to improved patient experiences, and reduce medical expenditures from excess adverse events.